package com.second.member.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.second.common.pojo.Member;
import com.second.common.vo.Result;
import com.second.member.service.MemberService;
import com.second.member.vo.MemberVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: second
 * @description:
 * @author: 胡萌
 * @create: 2023-05-29 14:35
 **/
@RestController
@RequestMapping("/member")
@Api(tags = "会员接口类")
public class MemberController {

    @Autowired
    private MemberService memberService;

    @ApiOperation("分页条件查询")
    @PostMapping("/getStudentAll/{current}/{pageSize}")
    public Result getAllOrder(
            @PathVariable Integer current,
            @PathVariable Integer pageSize,
            @RequestBody MemberVo memberVo
    ){
        Page<Member> studentAll = memberService.getStudentAll(current, pageSize, memberVo);
        return Result.success(studentAll);
    }

    @ApiOperation("修改用户状态")
    @PostMapping("/stateChange/{isDisabled}/{id}")
    public Result stateChange(
            @PathVariable Integer isDisabled,
            @PathVariable String id
    ){
        int i = memberService.updateIsDisabled(isDisabled, id);
        return Result.success();
    }

    @ApiOperation("修改用户")
    @PostMapping("/modifyStudentInformation")
    public Result modifyStudentInformation(@RequestBody Member member){

        int update = memberService.update(member);

        return Result.success();
    }



}
